<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<div class="page">
	<c:choose>
		<c:when test="${pb==null||pb.tp == 0 }">
			<span class="empty">当前内容为空!</span>
		</c:when>
		<c:otherwise>
			共${pb.tp }页/第${pb.pc }页&nbsp;&nbsp;
			<a href="${pb.url }&pc=1">首页</a>
			<c:if test="${pb.pc > 1 }">
				<a href="${pb.url }&pc=${pb.pc-1 }">上一页</a>
			</c:if>
			<c:choose>
				<c:when test="${pb.tp<=5 }">
					<c:set var="begin" value="1" />
					<c:set var="end" value="${pb.tp }" />
				</c:when>
				<c:otherwise>
					<c:set var="begin" value="${pb.pc-2 }" />
					<c:set var="end" value="${pb.pc+2 }" />
					<c:if test="${begin<1 }">
						<c:set var="begin" value="1" />
						<c:set var="end" value="5" />
					</c:if>
					<c:if test="${end>pb.tp }">
						<c:set var="begin" value="${pb.tp-4 }" />
						<c:set var="end" value="${pb.tp }" />
					</c:if>
				</c:otherwise>
			</c:choose>
			<c:forEach begin="${begin }" end="${end }" var="i">
				<c:choose>
					<c:when test="${i eq pb.pc }">
						[${i }]
					</c:when>
					<c:otherwise>
						<a href="${pb.url }&pc=${i }">[${i }]</a>
					</c:otherwise>
				</c:choose>
			</c:forEach>
			
			<c:if test="${pb.pc<pb.tp }">
				<a href="${pb.url }&pc=${pb.pc+1 }">下一页</a>
			</c:if>
			<a href="${pb.url }&pc=${pb.tp }">尾页</a>&nbsp;&nbsp;
			共${pb.tr }条记录
		</c:otherwise>
	</c:choose>
</div>
		